import os
import sys

sys.path.append(os.path.dirname(__file__))
from pydantic import BaseModel
from typing import List, Any, Optional


class Text2SQLRequest(BaseModel):
    question: str
    page: Optional[int] = 1
    page_size: Optional[int] = 10


class Text2SQLResponse(BaseModel):
    sql: str
    result: List[Any]
    answer: str = ""
    total: Optional[int] = None
    page: Optional[int] = None
    page_size: Optional[int] = None


class QueryHistory(BaseModel):
    question: str
    sql: str
    answer: str
    timestamp: str
    row_count: int
